# -*- coding:utf-8 -*-

import requests
import csv
import time


def down_file():
    with open('PDF下载.csv', 'r', encoding='utf-8') as f:
        reader = csv.reader(f)
        flag = False
        for row in reader:
            if flag:
                pdf_url = row[-1]
                pdf_name = row[2]
                file_type = pdf_url.split('.')[-1]
                time.sleep(3)
                res = requests.get(pdf_url, stream=True)
                with open(pdf_name + "." + file_type, "wb") as pdf_file:
                    pdf_file.write(res.content)
                print("==========【{}】下载完成===========".format(pdf_name))
            flag = True






if __name__ == '__main__':
    down_file()